package jnzb.nzb;

/**
 * Represents a single file segment
 * @author AA1
 *
 */
public class Segment {

	// attributes
	private int bytes;
	private int number;
	
	// body
	private String messageID;

	// Extra data for us to indicate whats been downloaded
	private String downloadedSegmentFilename=null;
	private boolean downloadAttempted=false;
	
	public int getBytes() {
		return bytes;
	}

	public void setBytes(int bytes) {
		this.bytes = bytes;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getMessageID() {
		return messageID;
	}

	public void setMessageID(String messageID) {
		this.messageID = messageID;
	}

	public String getDownloadedSegmentFilename() {
		return downloadedSegmentFilename;
	}

	public void setDownloadedSegmentFilename(String downloadedSegmentFilename) {
		this.downloadedSegmentFilename = downloadedSegmentFilename;
	}
	
	public boolean hasBeenDownloaded(){
		return this.downloadAttempted && this.downloadedSegmentFilename!=null;
	}
	
	public boolean downloadFailed(){
		return this.downloadAttempted && this.downloadedSegmentFilename==null;
	}

	public boolean isDownloadAttempted() {
		return downloadAttempted;
	}

	public void setDownloadAttempted(boolean downloadAttempted) {
		this.downloadAttempted = downloadAttempted;
	}
}
